package com.bestdreamer.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPoolTest {

    public static void main(String[] args) throws Exception{
        // 创建一个具有固定线程数（6）的线程池
        ExecutorService pool = Executors.newFixedThreadPool(6);
        pool.submit(new MyThread());
        pool.submit(new MyThread());
        // 关闭线程池
        pool.shutdown();
    }
}

class MyThread implements Runnable{
    public void run(){
        for(int i = 0; i < 100; i++){
            System.out.println(Thread.currentThread().getName()+"的 i 值为：" + 1);
        }
    }
}